<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/axios.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
	</head>
	<body> 
		<div id="app">
			<el-upload 
				class="upload-demo" 
				ref="upload" 
				action="http://localhost:8080/upload"
				:on-preview="handlePreview" 
				:limit="10" 
				:auto-upload="false">
					<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
					<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器
					</el-button>
				<div slot="tip" class="el-upload__tip">上传文件不可超过1Gb</div>
			</el-upload>
		</div>
	</body> 
	<script>
		new Vue({
			el: "#app",
			methods: {
				submitUpload:function() {
					this.$refs.upload.submit();
				},
				handlePreview(file) {
					window.open(file.response.url)
				}
			}
		})
	</script>
</html>
